<?
	require_once('init.php');
	require_once('dataModel.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<?='utf-8';?>" />
	<title><?=$AllPageTitle;?></title>
	<link href="css/CenterMenu.css" rel="stylesheet" type="text/css" />
	
	
	<? include("alljs.php"); ?>
	
	<script language="javascript">
   		function CheckData()
   		{
			value = $("#oldpass").attr("value");
	       	if( value=="")
	       	{
				parent.hiAlert("<?=$strwriteoldpwd;?>", '<?=$strclueinfo;?>');
				$("#oldpass").focus();
				return false;
	        }

			value = $("#newpass").attr("value");
	       	if( value=="")
	       	{
				parent.hiAlert("<?=$lng_plsenternewpass;?>", '<?=$strclueinfo;?>');
				$("#newpass").focus();
				return false;
	        }
	        else
	        {
	        	if (value.length<6) 
	        	{
					parent.hiAlert("<?=$lng_passtooshort;?>", '<?=$strclueinfo;?>');
					$("#newpass").focus();
					return false;
	        	}
	        }

			value = $("#cnfnewpass").attr("value");
	       	if( value=="")
	       	{
				parent.hiAlert("<?=$lng_plsenterconfpass;?>", '<?=$strclueinfo;?>');
				$("#cnfnewpass").focus();
				return false;
	        }

	       	if( $("#cnfnewpass").attr("value")!=$("#newpass").attr("value"))
	       	{
				parent.hiAlert("<?=$lng_passmismatch;?>", '<?=$strclueinfo;?>');
				$("#cnfnewpass").focus();
				return false;
	        }

			var strSQL = "";                      
			strSQL+= "userPWD=";
			strSQL+=$("#newpass").attr("value");
			strSQL+= "&oldPWD=";
			strSQL+=$("#oldpass").attr("value");
			strSQL+= "&Type=editpassword";
			
//			alert (strSQL);
			
			$.post("varifyData.php",strSQL,function(msg)
			{

//			    alert (msg);
			    
			   	if (msg=='1')
			   	{	
					parent.hiAlert("<?=$strpwdsuccess;?>", '<?=$strclueinfo;?>');
					$("#oldpass").attr("value","");
					$("#newpass").attr("value","");
					$("#cnfnewpass").attr("value","");
					$("#oldpass").focus();
					return false;
			   	}
			   	
			   	if (msg=='2')
			   	{	
					parent.hiAlert("<?=$stroldpwdw;?>", '<?=$strclueinfo;?>');
					$("#oldpass").focus();
					return false;
			   	}
			})
	    }    
	</script>
</head>


<body>
	<div id="MenuRighttitle" ><div style="padding-left:245px;padding-top:5px;"><b><?=$streditpwd;?></b></div></div>
	
	<div class="inner-container">
		<div class="bodypart" style="border:0px solid blue;">	
			<div style="padding-left: 120px; margin-top: 20px; text-align: left; min-height: 300px;border:0px solid blue;">
				<div class="userpwd-a01" style="margin-bottom:10px;"><b><?=$strwriteoldpwd.":";?></b></div>
				<div class="userpwd-a02"><input type="password" id="oldpass" name="oldpass" size="30" maxlength="50" class="userpwd_textbox" /></div>
				
				<div class="userpwd_a03"></div>
				
				<div class="userpwd-a01"><b><?=$strnewpwd.":";?></b></div>
				<div class="userpwd-a02"><input type="password" id="newpass" name="newpass" size="30" maxlength="50" class="userpwd_textbox" /></div>
				
				<div class="userpwd-a01" ><b><?=$strpwdagain.":";?></b></div>
				<div class="userpwd-a02"><input type="password" id="cnfnewpass" name="cnfnewpass" size="30" maxlength="50" class="userpwd_textbox" /></div>
				
				<div class="userpwd-a01" style="margin-top: 20px;width:500px;text-align:center;border:0px solid blue;">
					<input type="image" name="submitimage" src="<?=$lng_imagepath;?>submit_btn.gif" value="Submitimage"  onclick="javascript:CheckData();" />
					<input type="hidden" value="submit" name="submit" />
				</div>
			</div>
		</div>
	</div>
</body>

</html>
